<style lang="less" scoped>
	@border-color:#E3E8EA;//边框颜色
	@font-color:#686E71;//正常字体颜色
	@primary-color:#FE9333;//橘黄色默认颜色
    body,html{
        overflow-y: hidden;
        overflow-x: hidden;
        height: 100%;
    }
    .leftCenter{
        position: absolute;
        width: 240px;
        height: 100%;
    }
    .rightCenter{
        position: absolute;
        width: 87.5%;
        min-width: 1000px;
        left: 240px;
        min-height: 100%;
        height: 100%;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 10px;   
        word-wrap: break-word;
        .title{
            width: 100%;
            height: 50px;
            background-color: #fff;
            border: 1px solid #E3E8EA;
            text-align: center;
            margin-bottom: 10px;
            span{
                line-height: 46px;
                display: inline-block;
                margin-right: 60px;
                font-size: 14px;
                cursor: pointer;
            }
            .on{
                color:@primary-color;
                border-bottom: 2px solid @primary-color;
            }
        }
        .info{
            width: 100%;
            padding: 50px;
            background-color: #fff;
            border: 1px solid #E3E8EA;
            min-height: 650px;
            overflow: hidden;
            .notData{
                margin-top: 110px;
                margin: 110px auto;
                width: 120px;
                height: 200px;
                img{
                    width: 120px;
                    height: 120px;
                }
                p{
                    font-size: 14px;
                    color: #686E71;
                    text-align: center;
                    line-height: 22px;
                    margin-top: 10px;
                }
            }
        }
        .actionMessage{//活动消息
            width: 100%;
            padding: 50px;
            background-color: #fff;
            border: 1px solid #E3E8EA;
            min-height: 650px;
            overflow: hidden;
            .actionMessageNot{
                margin-top: 110px;
                margin: 110px auto;
                width: 120px;
                height: 200px;
                img{
                    width: 120px;
                    height: 120px;
                }
                p{
                    font-size: 14px;
                    color: #686E71;
                    text-align: center;
                    line-height: 22px;
                    margin-top: 10px;
                }
            }
            .actionMessageList{//活动消息列表
                width: 900px;
                margin: 0 auto;
                .handle{
                    line-height: 22px;
                    font-size: 14px;
                    color: #686E71;
                    border-bottom: 2px solid #E3E8EA;
                    margin-bottom: 20px;
                    padding: 0 25px;
                    span{
                        display: inline-block;
                        margin-right: 20px;
                        cursor: pointer;
                        margin-bottom: 10px;                
                    }
                }
                .li{
                    padding:6px 30px 18px 25px;
                    height: 132px;
                    border-bottom: 1px solid #E3E8EA;
                    cursor: pointer;
                    .left{
                        float: left;
                        margin-right: 26px;
                        position: relative;
                        .chexk{
                            position: absolute;
                            top:23px;
                            left:0;                           
                        }
                        .img{
                            width: 156px;
                            height: 108px;
                            border: 4px solid #fff;
                            box-shadow: 4px 4px 6px 0 rgba(0,0,0,0.1);
                            display: flex;
                            justify-content: center;
                            align-items: center;
                            margin-left: 31px;
                            img{
                                width: 148px;
                                height: 100px;
                            }
                        }
                    }
                    .right{
                        .time{
                            padding-top: 4px;
                            line-height: 22px;
                            overflow: hidden;
                            .notread{
                                width: 40px;
                                height: 19px;
                                line-height: 19px;
                                text-align: center;
                                border: 1px solid #FB9132;
                                border-radius: 4px;
                                margin-left: 10px;
                                font-size: 12px;
                                color: #FE9333;
                                font-weight: normal;
                            }
                            p{
                                max-width: 300px;
                                font-size: 16px;
                                color: #686E71;
                                float: left;
                                font-weight: bold;
                                white-space:nowrap;
                                text-overflow:ellipsis;
                                overflow:hidden;
                            }
                            span{
                                float: right;
                            }
                            .del{
                                width: 20px;
                                height: 20px;
                                display: inline-block;
                                background: url('../../images/center_delete.png') no-repeat;
                                background-size: 100% 100%;
                                cursor: pointer;
                            }
                            .t1{
                                font-size: 12px;
                                color: #B4BDC1;
                                margin-right: 10px;
                            }
                        }
                        .data{
                            margin-top: 8px;
                            font-size: 14px;
                            color: #686E71;
                            line-height: 22px;
                        }

                    }
                }
                .li:hover{
                    background-color: #FDF7F2;
                }
                .pages{
                    margin-top:30px;     
                    display: flex;
                    justify-content: center;                  
                }
            }
            .actionMessageData{//活动消息详情
                width: 900px;
                margin: 0 auto;
                .top{
                    padding: 0 25px;
                    p{
                        float: left;
                        font-size: 24px;
                        color: #FB9132;
                        line-height: 33px;                       
                    }
                    span{
                        float: right;
                        margin-top: 11px;                        
                    }
                    .back{
                        cursor: pointer;
                        line-height: 22px;                        
                        img{
                            width:20px;
                            height: 20px;
                            vertical-align: middle;
                            margin-right: 4px;
                        }
                    }
                    .t1{
                        font-size: 12px;
                        line-height: 22px;                        
                        color: #B4BDC1;
                        margin-right: 20px;
                    }
                }
                .line{
                    width: 900px;
                    height: 8px;
                    background: url('../../images/fengexian.png') no-repeat;
                    background-size: 100% 100%;
                    margin:  10px 0 26px 0;
                }
            }
        }
        .systemMessage{//系统消息
            width: 100%;
            padding: 50px;
            background-color: #fff;
            border: 1px solid #E3E8EA;
            min-height: 650px;
            overflow: hidden;
            .systemMessageNot{
                margin-top: 110px;
                margin: 110px auto;
                width: 120px;
                height: 200px;
                img{
                    width: 120px;
                    height: 120px;
                }
                p{
                    font-size: 14px;
                    color: #686E71;
                    text-align: center;
                    line-height: 22px;
                    margin-top: 10px;
                }
            }
            .systemMessageList{
                width: 900px;
                margin: 0 auto;
                .handle{
                    line-height: 22px;
                    font-size: 14px;
                    color: #686E71;
                    border-bottom: 2px solid #E3E8EA;
                    margin-bottom: 20px;
                    padding: 0 25px;
                    span{
                        display: inline-block;
                        margin-right: 20px;
                        cursor: pointer;
                        margin-bottom: 10px;                
                    }
                }
                .li{
                    padding:6px 30px 18px 25px;
                    // height: 117px;
                    border-bottom: 1px solid #E3E8EA;
                    .left{
                        float: left;
                        position: relative;
                        width: 34px;
                        height: 20px;
                        .chexk{
                            position: absolute;
                            top:23px;
                            left:0;                           
                        }
                    }
                    .right{
                        float: left;
                        width: 810px;
                        text-align: justify;
                        .time{
                            padding-top: 4px;
                            line-height: 22px;
                            overflow: hidden;
                            .notread{
                                width: 40px;
                                height: 19px;
                                line-height: 19px;
                                text-align: center;
                                border: 1px solid #FB9132;
                                border-radius: 4px;
                                margin-left: 10px;
                                font-size: 12px;
                                color: #FE9333;
                            }
                            p{
                                max-width: 300px;
                                font-size: 16px;
                                color: #FE9333;       
                                float: left;
                                font-weight: bold;
                                white-space:nowrap;
                                text-overflow:ellipsis;
                                overflow:hidden;
                            }
                            span{
                                float: right;
                            }
                            .del{
                                width: 20px;
                                height: 20px;
                                display: inline-block;
                                background: url('../../images/center_delete.png') no-repeat;
                                background-size: 100% 100%;
                                cursor: pointer;
                            }
                            .t1{
                                font-size: 12px;
                                color: #B4BDC1;
                                margin-right: 10px;
                            }
                        }
                        .data{
                            margin-top: 8px;
                            font-size: 14px;
                            color: #686E71;
                            line-height: 22px;
                        }

                    }
                }
                .li:hover{
                    background-color: #FDF7F2;
                }
                .pages{
                    margin-top:30px;     
                    display: flex;
                    justify-content: center;                  
                }
            }
        }
        .biographyMessage{
            width: 100%;
            padding: 50px;
            background-color: #fff;
            border: 1px solid #E3E8EA;
            min-height: 650px;
            overflow: hidden;
            .biographyMessageNot{
                margin-top: 110px;
                margin: 110px auto;
                width: 120px;
                height: 200px;
                img{
                    width: 120px;
                    height: 120px;
                }
                p{
                    font-size: 14px;
                    color: #686E71;
                    text-align: center;
                    line-height: 22px;
                    margin-top: 10px;
                }
            }
            .biographyMessageList{//活动消息列表
                width: 900px;
                margin: 0 auto;
                .handle{
                    line-height: 22px;
                    font-size: 14px;
                    color: #686E71;
                    border-bottom: 2px solid #E3E8EA;
                    padding: 0 25px;
                    span{
                        display: inline-block;
                        margin-right: 20px;
                        cursor: pointer;
                        margin-bottom: 10px;                
                    }
                }
                .li{
                    padding:20px 30px 18px 25px;
                    // height: 132px;
                    border-bottom: 1px solid #E3E8EA;
                    cursor: pointer;
                    .left{
                        float: left;
                        margin-right: 26px;
                        position: relative;
                        .chexk{
                            position: absolute;
                            top:23px;
                            left:0;                           
                        }
                        .img{
                            width: 60px;
                            height: 60px;
                            margin-left: 31px;
                            img{
                                width: 60px;
                                height: 60px;
                            }
                        }
                    }
                    .right{
                        .time{
                            padding-top: 4px;
                            line-height: 22px;
                            overflow: hidden;
                            .notread{
                                width: 40px;
                                height: 19px;
                                line-height: 19px;
                                text-align: center;
                                border: 1px solid #FB9132;
                                border-radius: 4px;
                                margin-left: 10px;
                                font-size: 12px;
                                color: #FE9333;
                            }
                            p{
                                max-width: 300px;
                                font-size: 16px;
                                color: #686E71;
                                float: left;
                                font-weight: bold;
                                white-space:nowrap;
                                text-overflow:ellipsis;
                                overflow:hidden;
                                i{
                                    font-style: normal;
                                    color:#4DB2EB;
                                }
                            }
                            span{
                                float: right;
                            }
                            .del{
                                width: 20px;
                                height: 20px;
                                display: inline-block;
                                background: url('../../images/center_delete.png') no-repeat;
                                background-size: 100% 100%;
                                cursor: pointer;
                            }
                            .t1{
                                font-size: 12px;
                                color: #B4BDC1;
                                margin-right: 10px;
                            }
                        }
                        .data{
                            margin-top: 8px;
                            font-size: 14px;
                            color: #686E71;
                            line-height: 22px;
                        }

                    }
                }
                .li:hover{
                    background-color: #FDF7F2;
                }
                .pages{
                    margin-top:30px;     
                    display: flex;
                    justify-content: center;                  
                }
            }
        }
    }
</style>
<style lang="less">
    .ivu-checkbox-wrapper{
        margin-right:20px;
    }
</style>

<template>
	<div>
        <!--左侧个人导航-->
        <v-userCenter class="leftCenter" :li1="li1" :li2="li2" :li3="li3" :li4="li4" :headerPicture="headerPicture" :username="username"></v-userCenter>
        <!--右侧内容-->
        <div class="rightCenter" ref="rightCenterRef">
            <!--标题-->
            <div class="title">
                <span :class="jcdataClass" @click.stop="chooset1()">活动消息</span>
                <span :class="threebing" @click.stop="chooset2()" >传记消息</span>
                <span :class="zjzl" @click.stop="chooset3()" >系统消息</span>
            </div>
            <!--活动消息-->
            <div class="actionMessage" v-show="infoDiv1">
                <!--缺省页面-->
                <div class="actionMessageNot" v-show="actionMessageList.length == 0"><img src="../../images/blank_news.png"/><p>暂无数据</p></div>
                <!-- 消息列表 -->
                <div class="actionMessageList" v-show="actionMessageList.length != 0 && !actionMessageDataFlg">
                    <!-- 功能 -->
                    <div class="handle">
                        <Checkbox v-model="allChooseActionFlg"></Checkbox>
                        <span @click.stop="allChooseActionFlg = !allChooseActionFlg">本页全选</span>
                        <span @click.stop="delChooseAction(2)">删除</span>
                        <span @click.stop="allreaded(2)">全部标记已读</span>
                        <span @click.stop="delreaded(2)">删除已读消息</span>
                    </div>
                    <!-- 内容 -->
                    <div class="li clearfix" v-for="(item,index) in actionMessageList" @click.stop="showactionMessageFun(item.title,item.createTime,item.content,item.id,item.status)">
                        <div class="left">
                            <div class="chexk" @click.stop="">
                                <Checkbox v-model="isChooseMsg[index]"></Checkbox>                                
                            </div>
                            <div class="img">
                                <img :src="imgurl+item.activityPicturePath"/>
                            </div>
                        </div>
                        <div class="right">
                            <!-- 标题和时间 -->
                            <div class="time ">
                                <p>{{item.title}}</p>
                                <p class="notread" v-show="item.status == 0">未读</p>                                
                                <span class="del" @click.stop="delactionMessage(2,item.id)"></span>                                
                                <span class="t1">{{birthdayTime(item.createTime)}}</span>
                            </div>
                            <div class="data" >{{item.profile}}</div>
                        </div>
                    </div>                  
                    <!-- 分页 -->
                    <div class="pages">
                        <Page :total="actionMessageTotal" :page-size="10" @on-change="actionMessagePage" :current="startPage"></Page>
                    </div>
                </div>
                <!-- 消息详情页面 -->
                <div class="actionMessageData" v-show="actionMessageDataFlg">
                    <!-- 标题 -->
                    <div class="top clearfix">
                        <p>{{actionMessageInfoTitle}}</p>
                        <span class="back" @click.stop="backMessageList"><img src="../../images/usercenter_news_back.png"/>返回</span>                        
                        <span class="t1">{{birthdayTime(actionMessageInfoTime)}}</span>
                    </div>
                    <!-- 线 -->
                    <div class="line"></div>
                    <!-- 内容 -->
                    <div class="content" v-html="actionMessageInfoContent"></div>
                </div>
            </div>
            <!--传记消息-->
            <div class="biographyMessage" v-show="infoDiv2">   
                <!--缺省页面-->
                <div class="biographyMessageNot" v-show="biographyMessageList.length == 0 "><img src="../../images/blank_news2.png"/><p>暂无数据</p></div>  
                <!-- 消息列表 -->
                <div class="biographyMessageList" v-show="biographyMessageList.length != 0 ">
                    <!-- 功能 -->
                    <div class="handle">
                        <Checkbox v-model="allChooseBiographyFlg"></Checkbox>
                        <span @click.stop="allChooseBiographyFlg = !allChooseBiographyFlg">本页全选</span>
                        <span @click.stop="delChooseAction(3)">删除</span>
                    </div>
                    <!-- 内容 -->
                    <div class="li clearfix" v-for="(item,index) in biographyMessageList" @click.stop="goPublish(item.cemeteryId,item.templateId)">
                        <div class="left">
                            <div class="chexk">
                                <Checkbox v-model="isChooseBiographyMsg[index]"></Checkbox>                                
                            </div>
                            <div class="img">
                                <img :src="item.headerPicture?imgurl+item.headerPicture:staticimg+'/images/Visitorsmoren.png'"/>
                            </div>
                        </div>
                        <div class="right">
                            <!-- 标题和时间 -->
                            <div class="time ">
                                <p>{{item.senderUser ? item.senderUser+'在':'游客' +'在 '}}<i> {{item.title}} </i>{{item.contentType==1?'留言':'回复'}}</p>
                                <span class="del" @click.stop="delactionMessage(3,item.id)"></span>                                
                                <span class="t1">{{birthdayTime(item.createTime)}}</span>
                            </div>
                            <div class="data">{{item.content}}</div>
                        </div>
                    </div>                  
                    <!-- 分页 -->
                    <div class="pages">
                        <Page :total="biographyMessageTotal" :page-size="10" @on-change="biographyMessagePage" :current="startPage"></Page>
                    </div>
                </div>                     
            </div>
            <!--系统消息-->
            <div class="systemMessage" v-show="infoDiv3">   
                <!--缺省页面-->
                <div class="systemMessageNot" v-show="systemMessageList.length == 0"><img src="../../images/blank_news3.png"/><p>暂无数据</p></div>     
                <!-- 消息列表  -->
                <div class="systemMessageList" v-show="systemMessageList.length != 0">
                    <!-- 功能 -->
                    <div class="handle">
                        <Checkbox v-model="allChooseSystemFlg"></Checkbox>
                        <span @click.stop="allChooseSystemFlg = !allChooseSystemFlg">本页全选</span>
                        <span @click.stop="delChooseAction(1)">删除</span>
                    </div>
                    <!-- 内容 -->
                    <div class="li clearfix" v-for="(item,index) in systemMessageList">
                        <div class="left">
                            <div class="chexk">
                                <Checkbox v-model="isChooseSystemMsg[index]"></Checkbox>                                
                            </div>
                        </div>
                        <div class="right">
                            <!-- 标题和时间 -->
                            <div class="time ">
                                <p>{{item.title}}</p>
                                <span class="del" @click.stop="delactionMessage(1,item.id)"></span>                                
                                <span class="t1">{{birthdayTime(item.createTime)}}</span>
                            </div>
                            <div class="data">{{item.content}}</div>
                        </div>
                    </div>                  
                    <!-- 分页 -->
                    <div class="pages">
                        <Page :total="systemMessageTotal" :page-size="10" @on-change="systemMessagePage" :current="startPage"></Page>
                    </div>
                </div>
            </div>
        </div> 

	</div>
</template>
<script>
    import global from '../../config/global'
	import { mapState } from 'vuex'
    import { USER_SIGNIN } from 'store/user'
    export default {
        computed: mapState({ user: state => state.user }),
        data() {
			return {
                imgurl:global.imgurl,
				staticimg:global.staticimg,
				videourl:global.videourl,
				musicurl:global.musicurl,
                jcdataClass:"on",//二维码绑定
                threebing:"",//墓穴信息
                zjzl:"",//传记人物资料
                li1:"li1",
                li2:"li2",
                li3:"li3",
                li4:"li4 on4",
                infoDiv1:true,//二维码绑定
                infoDiv2:false,//墓穴信息
                infoDiv3:false,//传记人物资料
                username:"",
                headerPicture:"",
                startPage:1,//数据页码
                actionMessageList:[],//活动消息列表
                actionMessageDataFlg:false,//活动消息查看详情
                actionMessageInfoTitle:"",//活动消息查看详情标题
                actionMessageInfoTime:"",//活动消息查看详情时间
                actionMessageInfoContent:"",//活动消息查看详情内容
                isChooseMsg:[],
                allChooseActionFlg:false,//活动消息本页全选
                actionMessageTotal:1,//活动消息页码
                systemMessageList:[],//系统消息列表
                allChooseSystemFlg:false,//系统消息本页全选                
                isChooseSystemMsg:[],//系统消息多选数组                
                systemMessageTotal:1,//系统消息页码
                allTotal:1,//公用数据总页码
                biographyMessageList:[],//传记消息列表
                isChooseBiographyMsg:[],//传记消息多选数组
                allChooseBiographyFlg:false,//传记消息本页全选
                biographyMessageTotal:1,
			}
		},
        created() {
            if(localStorage.getItem('headerImg') != null){
                this.headerPicture = localStorage.getItem('headerImg');     
            }
            if(localStorage.getItem('nickname') != null){
                this.username = localStorage.getItem('nickname');     
            }
            if(this.$route.query.type == 1){
                this.chooset3();
            }else if(this.$route.query.type == 2){
                this.chooset1();
            }else if(this.$route.query.type == 3){
                 this.chooset2();
            }
		},
        watch:{
            "allChooseActionFlg":"allChooseActionFun",
            "allChooseSystemFlg":"allChooseSystemFun",
            "allChooseBiographyFlg":"allChooseBiographyFun"
		},
		methods: {
          chooset1(){//
                this.jcdataClass = "on";//选中样式
                this.threebing = "";
                this.zjzl = "";
                this.infoDiv1 = true;
                this.infoDiv2 = false;
                this.infoDiv3 = false;
                //获取传记列表
                this.ajax(2);
                this.startPage = 1;
            },
            chooset2(){//墓穴信息
                this.jcdataClass = "";
                this.threebing = "on";
                this.zjzl = "";
                this.infoDiv1 = false;
                this.infoDiv2 = true;
                this.infoDiv3 = false;
                //this.ajax(3);       
                this.allreaded(3);
                localStorage.setItem("prememoir", 0);
                this.startPage = 1;         
            },
            chooset3(){//传记人物资料
                this.jcdataClass = "";
                this.threebing = "";
                this.zjzl = "on";
                this.infoDiv1 = false;
                this.infoDiv2 = false;
                this.infoDiv3 = true;
                this.allreaded(1);      
                localStorage.setItem("presystem", 0);	
                this.startPage = 1;          
            },
            ajax(type){//查询消息
                this.$http.post(global.host+'/message/query',{"type":type,"startPage":this.startPage,"pageSize":10},{headers:{"Authorization":this.user.token_type+" "+this.user.access_token}})
				.then((response) => {
                    this.allTotal = response.body.total;
                    if(type == 1){
                        this.$Notice.close('system');
                        localStorage.setItem("presystem", 0);
                        this.systemMessageList = response.body.result;
                        this.systemMessageTotal = response.body.total;
                        this.allChooseSystemFlg = false;
                        for(var i = 0; i <this.systemMessageList.length; i++){//选中状态置空
                            this.isChooseSystemMsg[i]=false;
                        }
                    }else if(type == 2){
                        this.$Notice.close('activity');
                        this.actionMessageList = response.body.result;
                        this.actionMessageTotal = response.body.total;
                        this.allChooseActionFlg = false;                        
                        for(var i = 0; i <this.actionMessageList.length; i++){//选中状态置空
                            this.isChooseMsg[i]=false;
                        }
                    }else if(type == 3){
                        this.$Notice.close('memoir');
                        localStorage.setItem("prememoir", 0);
                        this.biographyMessageList = response.body.result;
                        this.biographyMessageTotal = response.body.total;
                        this.allChooseBiographyFlg = false;                        
                        for(var i = 0; i <this.biographyMessageList.length; i++){//选中状态置空
                            this.isChooseBiographyMsg[i]=false;
                        }              
                        if(response.body.total != 0){
                            //有传记消息

                        }  
                    }
				})
				.catch(function (response) {
					
				})
            },
            systemMessagePage(value){
                this.allChooseSystemFlg = false;//重置全选状态
                this.startPage = value;
                this.ajax(1);
                this.$refs['rightCenterRef'].scrollTop = 0;
            },
            actionMessagePage(value){//跳转页面
                this.allChooseActionFlg = false;//重置全选状态
                this.startPage = value;
                this.ajax(2);
                this.$refs['rightCenterRef'].scrollTop = 0;
            },
            biographyMessagePage(value){
                this.allChooseBiographyFlg = false;//重置全选状态
                this.startPage = value;
                this.ajax(3);
                this.$refs['rightCenterRef'].scrollTop = 0;
            },
            showactionMessageFun(title,time,content,id,status){//查看活动消息详情
                this.actionMessageDataFlg = true;
                this.actionMessageInfoTitle=title;//活动消息查看详情标题
                this.actionMessageInfoTime=time;//活动消息查看详情时间
                this.actionMessageInfoContent=content;//活动消息查看详情内容
                //标记消息为已读消息
                if(status == 0){
                    var a = localStorage.getItem("preactivity");
                    localStorage.setItem("preactivity", a-1);
                }
                this.$http.post(global.host+'/message/readed',{"ids":id},{headers:{"Authorization":this.user.token_type+" "+this.user.access_token}})
                .then((response) => {
                    
                })
                .catch(function (response) {
                    
                }) 
            },
            backMessageList(){//回到活动消息列表
                this.actionMessageDataFlg = false;
                this.ajax(2);
            },
            chooseAction(index){//选中活动消息
                this.$set(this.isChooseMsg,index,!this.isChooseMsg[index]);
                console.log(this.isChooseMsg);
            },
            allChooseActionFun(){
                if(this.allChooseActionFlg){
                    for(var i = 0; i < this.actionMessageList.length; i++){
                        this.isChooseMsg[i]=true;
                    }
                }else{
                    for(var i = 0; i < this.actionMessageList.length; i++){
                        this.isChooseMsg[i]=false;
                    }
                }
            },
            allChooseSystemFun(){
                if(this.allChooseSystemFlg){
                    for(var i = 0; i < this.systemMessageList.length; i++){
                        this.isChooseSystemMsg[i]=true;
                    }
                }else{
                    for(var i = 0; i < this.systemMessageList.length; i++){
                        this.isChooseSystemMsg[i]=false;
                    }
                }
            },
            allChooseBiographyFun(){
                if(this.allChooseBiographyFlg){
                    for(var i = 0; i < this.biographyMessageList.length; i++){
                        this.isChooseBiographyMsg[i]=true;
                    }
                }else{
                    for(var i = 0; i < this.biographyMessageList.length; i++){
                        this.isChooseBiographyMsg[i]=false;
                    }
                }
            },
            delChooseAction(type){//批量删除消息     
                var ids = [];
                if(type == 2){
                    for(var i = 0;i < this.actionMessageList.length; i++){
                        if(this.isChooseMsg[i]){
                            ids.push(this.actionMessageList[i].id)
                        }
                    }
                }
                if(type == 1){
                    for(var i = 0;i < this.systemMessageList.length; i++){
                        if(this.isChooseSystemMsg[i]){
                            ids.push(this.systemMessageList[i].id)
                        }
                    }
                }
                if(type == 3){
                    for(var i = 0;i < this.biographyMessageList.length; i++){
                        if(this.isChooseBiographyMsg[i]){
                            ids.push(this.biographyMessageList[i].id)
                        }
                    }
                }
                if(ids.length == 0){
                    this.$Message.error("请先选择消息");
                    return;
                }   
                this.$Modal.confirm({
                width:"320",
                content: "<p>确定要删除选中的消息么？</p>",
                    onOk: () => {
                        this.$http.post(global.host+'/message/delete',{"ids":ids.join(',')},{headers:{"Authorization":this.user.token_type+" "+this.user.access_token}})
                        .then((response) => {
                            if(response.body.status = 1){
                                this.$Message.success("删除成功！");
                                if(this.startPage == Math.ceil(this.allTotal/10) && this.allTotal%10 == ids.length){
                                    if(this.startPage == 1){
                                        this.startPage = 1
                                    }else{
                                        this.startPage = this.startPage-1;                                       
                                    }
                                }                               
                            }else{
                                return;
                            }
                            if(type == 1){
                                console.log('删除的是系统消息');
                                this.ajax(type);
                            }
                            if(type == 2){
                                console.log('删除的是活动消息');
                                this.ajax(type);
                            }
                            if(type == 3){
                                console.log('删除的是传记消息');
                                this.ajax(type);
                            }
                        })
                        .catch(function (response) {
                        }) 
                    },
                    onCancel: () => {
                    }
                });
                
            },
            delactionMessage(type,id){//删除消息
                this.$Modal.confirm({
                width:"320",
                content: "<p>确定要删除这条消息么？</p>",
                    onOk: () => {
                        this.$http.post(global.host+'/message/delete',{"ids":id},{headers:{"Authorization":this.user.token_type+" "+this.user.access_token}})
                        .then((response) => {
                            if(this.startPage == Math.ceil(this.allTotal/10) && this.allTotal%10 == 1){
                                if(this.startPage == 1){
                                    this.startPage =1;
                                }else{
                                    this.startPage = this.startPage -1;                                    
                                }
                            }
                            if(type == 1){
                                console.log('删除的是系统消息');
                                this.ajax(type);
                            }
                            if(type == 2){
                                console.log('删除的是活动消息');
                                this.ajax(type);
                            }
                            if(type == 3){
                                console.log('删除的是传记消息');
                                this.ajax(type);
                            }
                        })
                        .catch(function (response) {
                        }) 
                    },
                    onCancel: () => {
                    }
                });

            },
            allreaded(type){//全部标记已读
                this.$http.post(global.host+'/message/readed/all',{"type":type},{headers:{"Authorization":this.user.token_type+" "+this.user.access_token}})
                .then((response) => {
                    if(response.body.status == 1 && type==2){
                        this.$Message.success("标记成功");
                    }
                    // if(type == 2){
                        this.ajax(type);
                    // }
                })
                .catch(function (response) {
                }) 
            },
            delreaded(type){//删除已读消息
                this.$Modal.confirm({
                    width:"320",
                    content: "<p>确定要删除已读消息么？</p>",
                    onOk: () => {
                        this.$http.post(global.host+'/message/delete/readed',{"type":type},{headers:{"Authorization":this.user.token_type+" "+this.user.access_token}})
                        .then((response) => {
                            if(type == 2){
                                this.ajax(type);
                            }
                        })
                        .catch(function (response) {
                        }) 
                    },
                    onCancel: () => {
                    }
                });
                
            },
            goPublish(cemeteryId,templateId){//点击传记消息跳转到传记发布页面
                if(!cemeteryId){
                    this.$Message.error("该传记或留言已删除！")
                    return;
                }
                this.$router.push({ path: '/publish',query:{"cemeteryId":cemeteryId,"template":templateId}});//跳转传记页面
            },
            birthdayTime(time){//解析时间戳         
                function add0(m) {
					return m < 10 ? '0' + m : m
				}
				var time = new Date(parseInt(time));
				var y = time.getFullYear();
				var m = time.getMonth() + 1;
				var d = time.getDate();				
				return y + '-' + add0(m) + '-' + add0(d) +' '+time.toTimeString().substr(0, 8);                
            },
         
		},
        components: {
            
        },
    }
</script>